package com.apexedu.biz.entity;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 * 定时器设置
 * Created by ly on 2014/12/2.
 */
@Entity
@Table(name = "T_TIMER")
public class TTimer implements Serializable {
    private String wid;
    private String timername; //定时器名称
    private String timercode; //定时器编码 字典表timer_code
    private Date starttime; //开始时间
    private String intervaltype; //间隔时间单位 字典表timer_jgsj
    private Integer interval; //间隔时间数
    private String state; //状态 1为可用 0为禁用

    private Date lasttime; //上次执行时间
    private Long executesecond; //执行时长 秒数
    private Date nexttime; //下次执行时间
    private String st; //状态
    private String errorlog; //错误日志

    //b.lasttime,b.executesecond,b.nexttime,b.state as st,b.errorlog

    public TTimer() {
    }

    public TTimer(String wid, String timername, String timercode, Date starttime, String intervaltype, Integer interval, String state) {
        this.wid = wid;
        this.timername = timername;
        this.timercode = timercode;
        this.starttime = (Date) starttime.clone();
        this.intervaltype = intervaltype;
        this.interval = interval;
        this.state = state;
    }

    @Id
    @Column(name = "WID")
    public String getWid() {
        return wid;
    }

    public void setWid(String wid) {
        this.wid = wid;
    }

    @Basic
    @Column(name = "TIMERNAME")
    public String getTimername() {
        return timername;
    }

    public void setTimername(String timername) {
        this.timername = timername;
    }

    @Basic
    @Column(name = "TIMERCODE")
    public String getTimercode() {
        return timercode;
    }

    public void setTimercode(String timercode) {
        this.timercode = timercode;
    }

    @Basic
    @Column(name = "STARTTIME")
    public Date getStarttime() {
        return (Date) starttime.clone();
    }

    public void setStarttime(Date starttime) {
        this.starttime = (Date) starttime.clone();
    }

    @Basic
    @Column(name = "INTERVALTYPE")
    public String getIntervaltype() {
        return intervaltype;
    }

    public void setIntervaltype(String intervaltype) {
        this.intervaltype = intervaltype;
    }

    @Basic
    @Column(name = "INTERVAL")
    public Integer getInterval() {
        return interval;
    }

    public void setInterval(Integer interval) {
        this.interval = interval;
    }

    @Basic
    @Column(name = "STATE")
    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
    }

    @Override
    public String toString() {
        return "TTimer{" +
                "wid='" + wid + '\'' +
                ", timername='" + timername + '\'' +
                ", timercode='" + timercode + '\'' +
                ", starttime=" + starttime +
                ", intervaltype='" + intervaltype + '\'' +
                ", interval=" + interval +
                ", state='" + state + '\'' +
                '}';
    }

    @Transient
    public Date getLasttime() {
        return lasttime;
    }

    public void setLasttime(Date lasttime) {
        this.lasttime = lasttime;
    }

    @Transient
    public Long getExecutesecond() {
        return executesecond;
    }

    public void setExecutesecond(Long executesecond) {
        this.executesecond = executesecond;
    }

    @Transient
    public Date getNexttime() {
        return nexttime;
    }

    public void setNexttime(Date nexttime) {
        this.nexttime = nexttime;
    }

    @Transient
    public String getSt() {
        return st;
    }

    public void setSt(String st) {
        this.st = st;
    }

    @Transient
    public String getErrorlog() {
        return errorlog;
    }

    public void setErrorlog(String errorlog) {
        this.errorlog = errorlog;
    }
}
